package com.system.result;

public class CodeMsg {
	
	private String code;
	private String msg;
	
	//通用的错误码0X
	public static CodeMsg SERVER_ERROR = new CodeMsg("00", "服务端异常");
	public static CodeMsg SUCCESS = new CodeMsg("01", "success");
	public static CodeMsg EMPTY = new CodeMsg("02", "返回空值");
	public static CodeMsg PARAM_LACK = new CodeMsg("03", "请求参数不完整");
	public static CodeMsg LOGIN_ERROR = new CodeMsg("04", "用户名或密码错误");
	public static CodeMsg FKEY_FAIL = new CodeMsg("05", "FKEY校验失败");
//	public static CodeMsg ACCESS_LIMIT_REACHED= new CodeMsg(500104, "访问太频繁！");
	//登录模块 5002XX
//	public static CodeMsg SESSION_ERROR = new CodeMsg(500210, "Session不存在或者已经失效");
//	public static CodeMsg PASSWORD_EMPTY = new CodeMsg(500211, "登录密码不能为空");
//	public static CodeMsg MOBILE_EMPTY = new CodeMsg(500212, "手机号不能为空");
//	public static CodeMsg MOBILE_ERROR = new CodeMsg(500213, "手机号格式错误");
//	public static CodeMsg MOBILE_NOT_EXIST = new CodeMsg(500214, "手机号不存在");
//	public static CodeMsg PASSWORD_ERROR = new CodeMsg(500215, "密码错误");
	
	
	//娱乐订单模块3004XX
	//public static CodeMsg ORDER_NOT_EXIST = new CodeMsg("200300", "订单不存在");
	public static CodeMsg YL_ORDER_WAIT_PAY = new CodeMsg("200301", "订单待付款");
	public static CodeMsg YL_ORDER_WAIT_USE = new CodeMsg("200301", "订单待使用");
	public static CodeMsg YL_ORDER_WAIT_EVALUATE = new CodeMsg("200301", "订单待评价");
	public static CodeMsg YL_ORDER_REFUND = new CodeMsg("200304", "退款/售后");
	public static CodeMsg YL_ORDER_FINISH = new CodeMsg("200305", "已完成");
	
	
	//商品模块 5003XX
	
	
	//订单模块5004XX
	//public static CodeMsg ORDER_NOT_EXIST = new CodeMsg(500400, "订单不存在");
	public static CodeMsg ORDER_NOT_PAY = new CodeMsg("200305", "订单待付款");

	
	//秒杀模块 5005XX
//	public static CodeMsg MIAO_SHA_OVER = new CodeMsg(500500, "商品已经秒杀完毕");
//	public static CodeMsg REPEATE_MIAOSHA = new CodeMsg(500501, "不能重复秒杀");
//	public static CodeMsg MIAOSHA_FAIL = new CodeMsg(500502, "秒杀失败");
	
	
	//即使通信模块6001XX
	public static CodeMsg ONLINE = new CodeMsg("200305", "客户端上线请求");
	public static CodeMsg SEND_MESSAGE = new CodeMsg("200305", "客户端发送'发送消息'请求");
	public static CodeMsg RECEIVE_MESSAGE = new CodeMsg("200305", "服务端发送'接收消息'请求");
	public static CodeMsg DOWNLINE = new CodeMsg("200305", "客户端下线请求");
	
	//微信模块700XXX
	public static CodeMsg CODE_INVALID = new CodeMsg("700100", "微信登录凭证校验异常");
	
	
	private CodeMsg( ) {
	}
			
	private CodeMsg( String code,String msg ) {
		this.code = code;
		this.msg = msg;
	}
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public CodeMsg fillArgs(Object... args) {
		String code = this.code;
		String message = String.format(this.msg, args);
		return new CodeMsg(code, message);
	}

	@Override
	public String toString() {
		return "CodeMsg [code=" + code + ", msg=" + msg + "]";
	}
	
	
}
